(function(){"use strict";BX.namespace("BX.Kanban");BX.Kanban.DropZoneArea=function(e,n){this.dropZoneType=this.getDropZoneType(n.dropZoneType);this.dropZoneTimeout=BX.type.isNumber(n.dropZoneTimeout)&&n.dropZoneTimeout>500?n.dropZoneTimeout:8e3;this.grid=e;this.layout={container:null};this.dropZones=Object.create(null);this.dropZonesOrder=[]};BX.Kanban.DropZoneArea.prototype={getGrid:function(){return this.grid},addDropZone:function(e){e=e||{};if(this.getDropZone(e.id)!==null){return null}var n=this.getDropZoneType(e.type);var t=new n(e);if(!(t instanceof BX.Kanban.DropZone)){throw new Error("DropZone type must be an instance of BX.Kanban.DropZone")}t.setDropZoneArea(this);this.dropZones[t.getId()]=t;var o=this.getDropZone(e.targetId);var r=BX.util.array_search(o,this.dropZonesOrder);if(r>=0){this.dropZonesOrder.splice(r,0,t)}else{this.dropZonesOrder.push(t)}if(this.getGrid().isRendered()){this.render()}return t},updateDropZone:function(e,n){e=this.getDropZone(e);if(!e){return false}e.setOptions(n);e.render();return true},removeDropZone:function(e){var n=this.getDropZone(e);if(n){this.dropZonesOrder=this.dropZonesOrder.filter(function(e){return n!==e});delete this.dropZones[n.getId()];if(this.getGrid().isRendered()){this.render()}}return n},render:function(){var e=document.createDocumentFragment();var n=this.getDropZones();for(var t=0;t<n.length;t++){e.appendChild(n[t].render())}BX.cleanNode(this.getContainer());this.getContainer().appendChild(e)},getDropZone:function(e){var n=e instanceof BX.Kanban.DropZone?e.getId():e;return this.dropZones[n]?this.dropZones[n]:null},getDropZones:function(){return this.dropZonesOrder},getDropZonesCount:function(){return this.dropZonesOrder.length},getDropZoneType:function(e){var n=BX.Kanban.Utils.getClass(e);if(BX.type.isFunction(n)){return n}return this.dropZoneType||BX.Kanban.DropZone},getDropZoneTimeout:function(){return this.dropZoneTimeout},getContainer:function(){if(this.layout.container){return this.layout.container}this.layout.container=BX.create("div",{attrs:{className:"main-kanban-dropzone-area"}});return this.layout.container},emptyAll:function(){this.getDropZones().forEach(function(e){e.empty()})},show:function(){if(this.getDropZonesCount()){this.getContainer().classList.add("main-kanban-dropzone-show")}},hide:function(){this.getDropZones().forEach(function(e){e.unsetActive()});this.getContainer().classList.remove("main-kanban-dropzone-show")},setActive:function(){this.getContainer().classList.add("main-kanban-dropzone-area-active")},unsetActive:function(){this.getContainer().classList.remove("main-kanban-dropzone-area-active")}}})();